// pages/index/index.js
const app = getApp();
Page({
    // data: {
    //     currentTab: 0,
    //     //这里只做tab名和显示图标
    //     items: [{
    //         "text": "首页",
    //         "iconPath": "/images/icons/shouye-weixuanzhong.png",
    //         "selectedIconPath": "/images/icons/shouye-xuanzhong.png"
    //     },
    //     {
    //         "text": "商城",
    //         "iconPath": "/images/icons/shangcheng-weixuanzhong.png",
    //         "selectedIconPath": "/images/icons/shangcheng-xuanzhong.png"
    //     },
    //     {
    //         "text": "购物车",
    //         "iconPath": "/images/icons/gouwuche-weixuanzhong.png",
    //         "selectedIconPath": "/images/icons/gouwuche-xuanzhong.png"
    //     },
    //     {
    //         "text": "我的",
    //         "iconPath": "/images/icons/gerenzhongxin-weixuanzhong.png",
    //         "selectedIconPath": "/images/icons/gerenzhongxin-xuanzhong.png"
    //     }
    //     ]
    // },

    data: {
        currentTab: 0,
        color: "#8a8a8a",
        selectedColor: "#000000",
        //这里只做tab名和显示图标
        items: [{
            "text": "首页",
            "iconPath": "icon-shouye-weixuanzhong",
            "selectedIconPath": "icon-shouye-xuanzhong"
        },
        {
            "text": "商城",
            "iconPath": "icon-shangcheng-weixuanzhong",
            "selectedIconPath": "icon-shangcheng-xuanzhong"
        },
        {
            "text": "购物车",
            "iconPath": "icon-gouwuche-weixuanzhong",
            "selectedIconPath": "icon-gouwuche-xuanzhong"
        },
        {
            "text": "我的",
            "iconPath": "icon-gerenzhongxin-weixuanzhong",
            "selectedIconPath": "icon-gerenzhongxin-xuanzhong"
        }
        ]
    },

    swichNav: function (e) {
        let that = this;
        if (this.data.currentTab === e.target.dataset.current) {
            return false;
        } else {
            that.setData({
                currentTab: e.target.dataset.current
            })
        }
    },
    onLoad: function (option) {

    },
    onShow: function () {
        let _this = this;
        app.setThemeSkin(_this,function(res){
            _this.setData({
              selectedColor: res.skinColor
            });
        });
    },
    setThemeSkin (e) {
        let _this = this;
        app.setThemeSkin(_this,function(res){
            _this.setData({
              selectedColor: res.skinColor
            });
        });
    },
})